Navigation

  • index
  • next |
  • previous |
  • PyHowTo documentation »
  • Basic »
  • System »

Table of Contents

Python v3.7 HowTos:

  • ----------------
  • Recursion
  • Backtracking
  • Dynamic Programming
  • Greedy
  • Sort
  • Binary Search
  • Depth First Search [DFS]
  • Breadth First Search [BFS]
  • Binary Search Tree [BST]
  • ----------------
  • Array
  • String
  • Heap
  • Stack
  • Queue
  • Tree
  • Linked List
  • Hash Table
  • Bit Manipulation
  • Two Pointers
  • Math
  • Decorator
  • ----------------
  • Basic
  • Intermediate
  • Advanced
  • Interview
  • ----------------
  • Spark
  • Tkinter
  • Turtle
  • Games
  • Web
  • ----------------
  • About
  • History

Previous topic

Get the size of an object in bytes

Next topic

Get the system time

Quick search

Print the current call stackΒΆ

Print the current call stack.
import traceback

def f1():return abc()

def abc():traceback.print_stack()

f1()

Output:

File "7a070e70-25c4-11e7-bc90-3fdc1ec1c64d.py", line 5, in
    f1()
File "7a070e70-25c4-11e7-bc90-3fdc1ec1c64d.py", line 3, in f1
    def f1():return abc()
File "7a070e70-25c4-11e7-bc90-3fdc1ec1c64d.py", line 4, in abc
    def abc():traceback.print_stack()

See also

https://www.w3resource.com/python-exercises/python-basic-exercise-96.php

Navigation

  • index
  • next |
  • previous |
  • PyHowTo documentation »
  • Basic »
  • System »
© Copyright 2020, Sergiy Zaytsev, szaytsev@hotmail.com. Created using Sphinx 2.3.0.